package org.sheep.view;

import java.io.IOException;

import org.sheep.R;
import org.sheep.world.WorldMap;
import org.sheep.world.WorldMapFactory;
import org.xmlpull.v1.XmlPullParserException;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;

public class WorldMapView extends SurfaceView implements SurfaceHolder.Callback  {
	private WorldMap map;
	private int width;
	private int height;
	
	public WorldMapView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.WorldMapView);

        width = a.getInt(R.styleable.WorldMapView_width, 12);
        height = a.getInt(R.styleable.WorldMapView_height, 12);
        
        a.recycle();
		
		try {
			map = new WorldMapFactory(width, height).build();
		} catch (XmlPullParserException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3) {
		// TODO Auto-generated method stub
		
	}

	public void surfaceCreated(SurfaceHolder holder) {
		// TODO Auto-generated method stub
		
	}

	public void surfaceDestroyed(SurfaceHolder holder) {
		// TODO Auto-generated method stub
		
	}

}
